package com.zxl.prototype.type2;
/**
 * ��ֵ���͵ĳ�Ա��������ֵ�ĸ���,���������͵ĳ�Ա����ֻ��������,���������õĶ���.
 * Object object = new Object();
 * new Object �����ʵ��
 * object ���������
 * @author zxl
 * 2016��7��8��
 */
public class Test {

	public static void main(String[] args) {
			testPrototype();
		}
	
		private static void testPrototype() {
			Prototype pro = new Prototype();
			pro.setName("original object");
			NewPrototype newObj = new NewPrototype();
			newObj.setId("test1");
			newObj.setPrototype(pro);

			NewPrototype copyObj = (NewPrototype) newObj.clone();
			copyObj.setId("testCopy");
			copyObj.getPrototype().setName("changed object1");

			System.out.println("original object id:" + newObj.getId());
			System.out.println("original object name:"
					+ newObj.getPrototype().getName());

			System.out.println("cloned object id:" + copyObj.getId());
			System.out.println("cloned object name:"
					+ copyObj.getPrototype().getName());

		}

}
